

package com.scalar.chiptrack.users.forms;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackActionForm;

public class AccessLevelSetupForm extends ChipTrackActionForm {


    private int m_levelId = -1;
    private String m_levelName = null;
   
    public int getLevelId() {
        return m_levelId;
    }
    public void setLevelId (int id) {
        m_levelId = id;
    }
    
    public String getLevelName() {
        return m_levelName;
    }
    public void setLevelName (String name) {
        m_levelName = name;
    }
    
    public ActionErrors validate (ActionMapping mapping, javax.servlet.http.HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();

        if (((m_levelName == null) || (m_levelName.trim().length() == 0)) && (m_levelId == -1)) {
            errors.add ("levelId", new ActionError ("Select LevelID or Add a new Level Name"));
        }
        
        return errors;
    }
}